package com.skyworth.web.ordermenu;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by cody on 2016/8/23.
 */
@Service
public class OrderMenuServiceImpl implements OrderMenuService{

    @Autowired
    private OrderMenuRepository repository;

    /**
     * 退订某个菜品是，删除映射表的对应项
     * @param id
     */
    @Override
    public void deleteItem(Long id){
        repository.delete(id);
    }

    @Override
    public Iterable<OrderMenuModel> saveItems(List<OrderMenuModel> list) {
        return repository.save(list);
    }

    @Override
    public List<OrderMenuModel> findByOrderId(long id) {
        return repository.findByOrderId(id);
    }

    @Override
    public List<OrderMenuModel> findByPayOrderId(long id) {
        return repository.findByPayOrderId(id);
    }

    @Override
    public List<OrderMenuModel> findByNoPayOrderId(long id) {
        return repository.findByNoPayOrderId(id);
    }

    @Override
    public List<OrderMenuModel> findBySubOrderId(long id) {
        return repository.findBySubOrderId(id);
    }
}
